/*
 * FilePath     : \src\router\index.ts
 * Author       : 苏军志
 * Date         : 2023-06-04 08:42
 * LastEditors  : 苏军志
 * LastEditTime : 2025-03-12 17:21
 * Description  : 路由
 * CodeIterationRecord:
 */

import { createRouter, createWebHistory } from "vue-router";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      redirect: "/schedulingTable"
    },
    {
      path: "/schedulingTable",
      name: "schedulingTable",
      component: () => import("@/views/scheduling/schedulingTable.vue")
    }
  ]
});
// 解决发布新版本后，点击菜单时报错
router.onError((error) => {
  const fetchResourcesErrors = ["Failed to fetch dynamically imported module", "Importing a module script failed"];
  if (fetchResourcesErrors.some((item) => error.message.includes(item))) {
    window.location.reload();
  }
});
export default router;
